<%@ page import="java.util.*,
                 com.actimind.actitime.beans.*,
                 com.actimind.actitime.user.*,
                 com.actimind.actitime.*,
                 com.actimind.actitime.util.*"%>
<%@ page errorPage="/error.jsp" %>
<%@ taglib uri="/WEB-INF/at.tld" prefix="at" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<at:CheckLoggedIn/>
<bean:define id="form" scope="session" name="MonthSummaryForm" type="com.actimind.actitime.user.MonthSummaryForm"/>
<bean:define id="res" name="form" property="monthSummary" type="com.actimind.actitime.user.MonthSummaryResults"/>
<bean:define id="calendar" name="res" property="calPrefs" type="com.actimind.actitime.beans.CalendarPrefsBean"/>

<html>
<head>
    <title><bean:write name="title-prefix" scope="application"/> View My Time-Track</title>
    <link rel="stylesheet" href="../css/at.css" type="text/css">

</head>
<body bgcolor="#ffffff" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" onLoad="document.forms[0].autocomplete='off';">

<jsp:include page="../top.jsp" flush="false">
    <jsp:param name="pageSection" value="my_tt"/>
</jsp:include>

<br>

<html:form action="/user/my_tt" method="post">
<html:hidden property="submitted" value="true" />

<table width="800" align="center" cellspacing="0" cellpadding="0" border="0">
<tr>
    <td class="pagetitle" width="65%">View My Time-Track</td>
    <td class="text" align="right">
        Month:
        <html:select property="month" onchange="this.form.submit()" >
            <html:options property="months" labelProperty="monthsLabels" />
        </html:select>
        <html:select property="year" onchange="this.form.submit()">
            <html:options property="years" />
        </html:select>
    </td>
</tr>
<tr><td colspan="2"><at:errors/></td></tr>
</table>

<br>

<table width="800" align="center" cellspacing="1" cellpadding="3" border="0">
    <tr>
        <th colspan="3" align="left" class="listtblcolheader" nowrap="1" width="75%" valign="middle">
            <table width="100%" cellspacing="0" cellpadding="0" border="0">
            <tr>
                <th class="listtblcolheader" align="left">
                    <big><bean:write name="form" property="monthLabel"/></big>
                </th>
                <th class="listtblcolheader" align="right" valign="middle">
                    <table border="0" cellspacing="0" cellpadding="0" >
                        <tr>
                            <th class="listtblcolheader" align="right">Month Total:</th>
                        </tr>
                        <logic:equal name="res" property="overtimeEnabled" value="true"><tr>
                            <th class="white" align="right">Overtime:</th>
                        </tr></logic:equal>
                    </table>
                </th>
            </tr>
            </table>
        </th>
        <th align="left" width="5%" class="listtblcolheader" nowrap="1" valign="middle">
            <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <th class="listtblcolheader" align="left" valign="top"><bean:write name="res" property="printTotalWork"/></th><logic:equal name="res" property="overtimeEnabled" value="true"><tr>
                </tr>
                    <th align="right" class="white"><bean:write name="res" property="printTotalOvertime"/></th>
                </tr></logic:equal>
            </table>
          </th>
           <th align="left" width="20%" class="listtblcolheader" nowrap="1" valign="middle">
            <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <th class="listtblcolheader" align="left" valign="top">Comments</th>
                </tr>
            </table>
        </th>
    </tr>
<logic:iterate id="day" name="res" property="workData" type="com.actimind.actitime.user.DayInfo">
<tr>
    <td class="text" valign="top" colspan="3" <logic:equal value="true" name="day" property="workingDay">bgcolor="#D0D0D0"</logic:equal><logic:notEqual value="true" name="day" property="workingDay">bgcolor="#D0D0C0"</logic:notEqual>>
      <logic:equal value="true" name="day" property="workingDay"><html:link page="/user/submit_tt.do" paramId="dateStr" paramName="day" paramProperty="dateStr"><bean:write name="day" property="printDate"/></html:link></logic:equal><logic:notEqual value="true" name="day" property="workingDay"><html:link styleClass="weekend" page="/user/submit_tt.do" paramId="dateStr" paramName="day" paramProperty="dateStr"><bean:write name="day" property="printDate"/></html:link></logic:notEqual>
   </td><td class="text" align="center" <logic:equal value="true" name="day" property="workingDay">bgcolor="#D0D0D0"</logic:equal><logic:notEqual value="true" name="day" property="workingDay">bgcolor="#D0D0C0"</logic:notEqual>>
       <logic:equal value="true" name="day" property="workingDay"><font color="#003399"></logic:equal><logic:notEqual value="true" name="day" property="workingDay"><font color="#660000"></logic:notEqual><bean:write name="day" property="printTotalWork"/><logic:notEqual value="true" name="day" property="workingDay"></font></logic:notEqual>
    </td>
    <td <logic:equal value="true" name="day" property="workingDay">bgcolor="#D0D0D0"</logic:equal>
    <logic:notEqual value="true" name="day" property="workingDay">bgcolor="#D0D0C0"</logic:notEqual>>&nbsp;</td>
</tr>

<logic:iterate id="ab" name="day" property="ttRecords" type="com.actimind.actitime.user.TTInfo">

<%  String cls = "text";
    if (((TTInfo)ab).isTaskCompleted())
        cls = "textGrayed";

%>
<tr bgcolor="#E8E8E8">
    <td class="<%= cls %>" width="15%"><bean:write name="ab" property="customerName"/></td>
    <td class="<%= cls %>" width="15%"><bean:write name="ab" property="projectName"/></td>
    <td class="<%= cls %>" width="30%"><bean:write name="ab" property="taskName"/></td>
    <td class="text" nowrap="1" align="center" width="5%"><bean:write name="ab" property="formattedSpent"/></td>
    <td class="<%= cls %>" width="35%" align="left">
        <logic:equal value="false" name="ab" property="commentPresent">&nbsp;</logic:equal>
        <logic:equal value="true" name="ab" property="commentPresent">
            <%= StringUtils.encodeNewLineSymbols(StringUtils.encodeHTMLTagMarkers(ab.getComment()))%>
        </logic:equal>
    </td>
</tr>
</logic:iterate>

</logic:iterate>
<tr><td colspan="5"><img src="../img/pixel.gif" width="770" height="1" alt=""></td></tr>
</table>

</html:form>
<br>
<br>

</body>
</html>
